﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Globalization;
using System.IO;

namespace MySQL_Backup_and_Restore
{
    static class Program
    {
        public static myLogger mylog = new myLogger();
        public static ExceptionLogger exl = new ExceptionLogger();
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThreadAttribute]
        static void Main(string[] args)
        {
           
            string lang = "";
            try
            {
                lang = args[0];
            }
            catch (Exception ee)
            {
                Console.WriteLine(ee.Message);

            }

            CultureInfo cul = new CultureInfo(lang);

            Thread.CurrentThread.CurrentCulture = cul;
            Thread.CurrentThread.CurrentUICulture = cul;


            exl.NotificationType = NotificationType.Inform;

            exl.AddLogger(mylog);


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new BackupAr());
        }


        public class myLogger :  LoggerImplementation
        {
            public override void LogError(string error)
            {
                StreamWriter file = new StreamWriter(Application.StartupPath + "\\logbackup.log", true);
                file.Write(error);
                file.Flush();
                file.Close();
            }
        }


    }
}
